<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/css/global.css" media="all">
    <link rel="stylesheet" href="/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/table.css"/>
    <title>已关联交易对(app)</title>
    <style type="text/css">
        .searcheBottom{margin-bottom: 10px;}
        body{overflow-y: scroll;}
    </style>
</head>
<body class="admin-main">
<blockquote class="layui-elem-quote">
    <div class="demoTable">
        <div class="layui-inline searcheBottom">
            <div class="layui-inline" style="margin-right: 30px;">
                <h3><b>当前货币名称：${coinNameCn!}</b></h3>
                <input id="id" class="layui-input" autocomplete="off" value="${currencyId!}" style="display: none;"/>
                <input id="symbol" class="layui-input" autocomplete="off" value="${symbol!}" style="display: none;"/>
            </div>
        </div>
        <div class="layui-inline searcheBottom">
            <a data-opt="add" href="/manage/currency/appExTra?id=${currencyId!}&coinNameCn=${coinNameCn!}&symbol=${symbol!}" class="layui-btn" id="addReport"><i class="layui-icon">&#xe608;</i>关联交易对</a>
            <a class="layui-btn layui-btn-primary" href="/manage/currency/currencymanage">返回</a>
        </div>
    </div>
</blockquote>
<span style="font-size: 16px;"><b>已关联交易对(app)</b></span>
<table class="layui-hide" id="currencyTra" lay-filter="tableFilter"></table>
</div>
<script type="text/javascript" src="/plugins/layui/layui.js"></script>
<script>
    layui.use(['jquery','table','laydate','layer','form','util'],function(){
        var $=layui.jquery,table=layui.table,laydate = layui.laydate,
            layer = layui.layer,form = layui.form,util=layui.util;

        pageInit();
        //表格渲染
        function pageInit(){
            table.render({
                elem:"#currencyTra",
                url:"/manage/currency/selCurTra",
                method:"post",
                where:{currencyId: parseInt(${currencyId!})},
                cols:[[
                    {field:'id', title: 'ID', sort: true,align:'center'},
                    {field:'exchangeName', title: '交易所',align:'center'},
                    {field:'transactionAlias', title: '交易对',align:'center'},
                    {field: 'tool', title:"操作",align:'left',align:'center',
                        templet:function(d){
                            var tool = '';
//                            tool +='<a href="#" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="stat">统计</a>';
                            tool += '<a href="#" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
                            return tool;
                        }
                    }
                ]]
            });
        };

        table.on('tool(tableFilter)', function(obj){
            var data = obj.data;
            if (obj.event == "del") {
                $.ajax({
                    url:"/manage/currency/delAppCurTra",
                    type:"post",
                    dataType:"json",
                    data:{"id":data.id},
                    success:function(count){
                        pageInit();
                    }
                });
            }/*else if(obj.event == "stat"){
                $.ajax({
                    url:"/manage/currency/statAppCurTra",
                    type:"post",
                    dataType:"json",
                    data:{"id":data.id},
                    success:function(count){
                        pageInit();
                    }
                });
            }*/
        });
    });
</script>

</body>
</html>